#include<bits/stdc++.h>
#define sd(n) scanf("%d",&n) 
#define sld(n) scanf("%lld",&n)
#define pd(n) printf("%d", (n))
#define pld(n) printf("%lld", n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fi first
#define se second
const int N = 2e5;
const int maxn = 1e6;
typedef long long int ll;
using namespace std;
//----------------------------------------------------------------------------//
char a[10][10];
void solve()
{

    for (int i = 1; i <= 8; i++)
    {
        for (int j = 1; j <= 8; j++)
        {
            cin >> a[i][j];
        }
    }


    for (int i = 2; i <= 7; i++)
    {
        for (int j = 2; j <= 7; j++)
        {
            if (a[i][j] == '#' && a[i - 1][j - 1] == '#' && a[i + 1][j - 1] == '#' && a[i - 1][j + 1] == '#' && a[i + 1][j + 1] == '#')
            {
                cout << i << " " << j << '\n';
                return;
            }
        }
    }


}

int main()
{
    int T;
    sd(T);
    while (T--)
    {
        solve();
    }
    return 0;
}